import {reqCode, reqRegister, reqUserLogout} from "../api";
const state = {
  code:''
}
const mutations = {
   GETCODE(state,data){
    state.code = data.number
  }
}
const actions = {
  //获取验证码（未完成，模拟验证）
  async registerCode({commit}){
    let result = await reqCode()
    if (result){
      commit('GETCODE',result.data)
      return 'ok'
    }
  },
  //注册
  async getRegister({commit},data){
    await reqRegister(data)
  },
  //登出
  async userLogout(){
    await reqUserLogout()
  },
}
const getters = {}

export default {
  state,
  mutations,
  actions,
  getters
}
